package com.gy.api.tv.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import com.gy.api.base.ApiIndex;
import com.gy.api.base.R;
import com.gy.api.pc.sys.authority.domain.vo.SysAuthoritySearchVO;
import com.gy.api.pc.sys.authority.domain.vo.SysAuthorityTreeVO;
import com.gy.api.pc.sys.authority.service.ISysAuthorityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 用户信息
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("TV/system/user")
@Api( tags = ApiIndex.HuashuSysUserController)
public class HuashuSysUserController {

    @Autowired
    private ISysAuthorityService sysAuthorityService;

    @ApiOperation(value = "根据token获取菜单权限")
    @GetMapping("/menuByToken")
    @SaCheckLogin
    public R<List<SysAuthorityTreeVO>> getUserIdByToken() {
        SysAuthoritySearchVO searchVO=new SysAuthoritySearchVO();
        searchVO.setUserId(StpUtil.getLoginIdAsString());
        List<SysAuthorityTreeVO> list = sysAuthorityService.getTreeList(searchVO);
        return new R(list);
    }
}
